package com.cloudkinto.controller.calendar;


import com.cloudkinto.common.annotations.UserSessionRequired;
import com.cloudkinto.service.calendar.vo.CalendarHolidayRes;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.cloudkinto.service.calendar.CalendarHolidayService;

import com.cloudkinto.common.web.PageResult;
import com.cloudkinto.common.web.SingleResult;

import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.validation.annotation.Validated;

import java.util.HashMap;
import java.util.Map;

import com.cloudkinto.base.BaseController;

/**
 * <p>
 *  前端控制器
 * </p>
 * @author hua
 * @since 2023-12-28
 */
@RestController
@Api(tags = "日历模块")
@RequestMapping("/api/CalendarHoliday")
public class CalendarHolidayController extends BaseController {
    private final Logger logger = LoggerFactory.getLogger(CalendarHolidayController.class);

    @Autowired
    private CalendarHolidayService service;



    @UserSessionRequired
    @GetMapping("/list")
    @ApiOperation(value = "获取日历节假日", notes = "查询")
    @ApiImplicitParams({@ApiImplicitParam(name = "year", value = "年份")})
    @ApiResponses(@ApiResponse(code = 200, message = "", response = CalendarHolidayRes.class))
    public SingleResult list(HttpServletRequest request){
        Map<String, String> map = new HashMap<>();
        String year = request.getParameter("year");
        map.put("year", year);
        return SingleResult.success("查询成功", service.getList(map));
    }


}

